#ifndef SQLITEDB_H
#define SQLITEDB_H

#include <QObject>
#include <QtSql>

class SqliteDB : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QStringList strList READ strList)
    Q_PROPERTY(QSqlQuery * m_query READ m_query)
public:
    explicit SqliteDB(QObject *parent = 0);

    QSqlDatabase database;
    QSqlQuery *query;
    Q_INVOKABLE bool connectDB();
    Q_INVOKABLE void closeDB();
    QStringList getDBData(const QString sql);
    Q_INVOKABLE QStringList getDBData(int n, QString sql);
    Q_INVOKABLE QString getData(int i);
    Q_INVOKABLE QString getAData(QString sql);
    Q_INVOKABLE int strCount();

    QStringList strList() const;

    QSqlQuery *m_query() const;

signals:

public slots:

private:
    QStringList strlist;
};

#endif // SQLITEDB_H
